package com.common.utils;

import cn.hutool.http.cookie.GlobalCookieManager;

import java.io.Serializable;
import java.net.CookieManager;

/**
 * @author xin.you
 * @date 2021/4/14
 * @description
 */
public class HttpGlobalConfig implements Serializable {
    private static final long serialVersionUID = 1L;
    protected static int timeout = -1;

    public HttpGlobalConfig() {
    }

    public static int getTimeout() {
        return timeout;
    }

    public static void setTimeout(int customTimeout) {
        timeout = customTimeout;
    }

    public static CookieManager getCookieManager() {
        return GlobalCookieManager.getCookieManager();
    }

    public static void setCookieManager(CookieManager customCookieManager) {
        GlobalCookieManager.setCookieManager(customCookieManager);
    }

    public static void closeCookie() {
        GlobalCookieManager.setCookieManager((CookieManager)null);
    }
}
